/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:张熳
 * Date:2025-08-17
 * Time:9:23
 */
//类和对象

//创建类
class WashMachine{   //洗衣机
    //字段/属性/成员变量
    public String brand;//品牌
    public String type;//型号
    public double weight;//重量
    public double length;//长
    public double width;//宽
    public double height;//高
    public String color;//颜色

    //行为/成员方法
    public void washClothes(){
        //洗衣服
        System.out.println("洗衣功能");
    }
    public void dryClothes(){
        //脱水
        System.out.println("脱水功能");
    }
    public void setTime(){
        //定时
        System.out.println("定时功能");
    }
}

//定义一个狗类
//类 -> 类型 -> 自定义类型（属于引用类型）
class Dog{
    public String name;
    public int age;

    public void eat(){
        System.out.println(name + "吃狗粮");
    }

    public static void main(String[] args) {
        System.out.println("1234");
    }
}

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();//通过new实例化对象
        dog.name = "小黑";
        dog.age = 1;
        dog.eat();
        System.out.println(dog.name);
        System.out.println(dog.age);

        System.out.println("===============");

        Dog dog1 = new Dog(); //类可以通过new关键字实例化多个对象
        dog1.name = "小白";
        dog1.age = 10;
        dog1.eat();
        System.out.println(dog1.name);
        System.out.println(dog1.age);

        /*int a;
        System.out.println(a);*/ //在使用变量之前必须要初始化，否则会报错
    }
}
